#include<stdio.h>


typedef struct
{
    char id[20];
    char name[20];
    int ms;//数学成绩  
    int es;//英语成绩
    int cs;//计算机成绩
}student;

int mystrcmp(char *a,char *b);//判断两个id是否相等，相等返回0；

int main()
{
    int n;//循环次数
    scanf("%d",&n);
    int cmd=0;//控制操作
    
    student stu[140];
    int j=0;//记录学生人数
    for(int i=0;i<n;i++)
    {
        scanf("%d",&cmd);
        
        if(cmd==1)
        {
            int signal=1;//控制是否添加，1为添加，0为已存在
            char id1[11];//临时存储id
          
            scanf("%s",id1);
            if(j!=0)
            {
                for(int m=0;m<j;m++)
                {
                    if(mystrcmp(stu[m].id,id1)==0) signal=0;
                }
            }//判断
            if(signal!=0)
            {
                int n=0;
                for(;id1[n]!='\0';n++)
                {
                    stu[j].id[n]=id1[n];
                }
                stu[j].id[n]='\0';
               
                scanf("%s",stu[j].name);
                scanf("%d",&stu[j].ms);
                scanf("%d",&stu[j].es);
                scanf("%d",&stu[j].cs);
                j++;
                printf("Add success\n");
            }
            else 
            {
                printf("Students already exist\n");
                student eat;
                scanf("%s",eat.name);
                scanf("%d",&eat.ms);
                scanf("%d",&eat.es);
                scanf("%d",&eat.cs);
            }   
        }
                    //printf("Student ID:%s\n",stu[0].id);
                    //printf("Name:%s\n",stu[0].name);

         if(cmd==2)
        {
            int signal2=0;
            char id2[11];
            int cmd2=0;//记录要删除的数组
            scanf("%s",id2);
            if(j==0)  signal2=0;
            else for(;cmd2<j;cmd2++)
                {
                    if(mystrcmp(stu[cmd2].id,id2)==0) 
                    {
                        signal2=1;
                        break;
                    }
                }
            if(signal2==0) printf("Students do not exist\n");
            else
            {
               for(int z=0;stu[cmd2].id[z]!='\0';z++)
               {
                   stu[cmd2].id[z]=0;//把id删掉
               }
               printf("Delete success\n");
            }
            
        }
       if(cmd==3)
        {
            int signal3=0;
            char id3[11];
            int cmd3=0;
            scanf("%s",id3);
            if(j==0)  signal3=0;
            else for(;cmd3<j;cmd3++)
                {
                    if(mystrcmp(stu[cmd3].id,id3)==0) 
                    {
                        signal3=1;
                        break;
                    }
                }
            if(signal3==0) 
            {
                printf("Students do not exist\n");
                student eat;
                scanf("%d",&eat.ms);
                scanf("%d",&eat.es);
                scanf("%d",&eat.cs);
            }
            else
            {
                int ms3,es3,cs3;
                scanf("%d",&ms3);
                scanf("%d",&es3);
                scanf("%d",&cs3);
                stu[cmd3].ms=ms3;
                stu[cmd3].es=es3;
                stu[cmd3].cs=cs3;
                printf("Update success\n");
            }
        }

          if(cmd==4)
        {
            int signal4=0;
            char id4[11];
            int cmd4=0;
            scanf("%s",id4);
            if(j==0)  signal4=0;
            else for(;cmd4<j;cmd4++)
            {
                if(mystrcmp(stu[cmd4].id,id4)==0) 
                {
                    signal4=1;
                    break;
                }
            }
                if(signal4==0) printf("Students do not exist\n");
                else
                {
                    float average;
                    average=(stu[cmd4].cs+stu[cmd4].ms+stu[cmd4].es)*1.0/3;
                    printf("Student ID:%s\n",stu[cmd4].id);
                    printf("Name:%s\n",stu[cmd4].name);
                    printf("Average Score:%.1f\n",average);
                }
        }
        
    }
    return 0;
}

int mystrcmp(char *a,char *b)
{
    int signal=0;
    int i=0;
    for(;a[i]!='\0'&&b[i]!='\0';i++)
    {
        if(a[i]!=b[i]) signal=1;
    }
    if(a[i]!=0||b[i]!=0) signal=1;
    return signal;
}

//总结，记得吃掉数据

//above is mine;


/*#include<stdio.h>

typedef struct
{
	char name[22];
	long id;
	int math;
	int en;
	int cs;
	double ave;
	int state;
}STUDENT;

//定义区 
void  f1(STUDENT *stu,STUDENT *system,int target);
void  f2(STUDENT *stu,STUDENT *system,int target);
void  f3(STUDENT *stu,STUDENT *system,int target);
void  f4(STUDENT *stu,STUDENT *system,int target);

int storenum=0;
int search(STUDENT *system,long target);

int main()
{
	int n;
	scanf("%d",&n);
	STUDENT stu[140];
	STUDENT system[140]; 
	int i;
	for(i=0;i<n;i++)
	  {
	  	scanf("%d",&stu[i].state);
	  	scanf("%d",&stu[i].id);
	  	if(stu[i].state==1)
	  	{
	  	  scanf("%s",stu[i].name);
		  scanf("%d %d %d",&stu[i].math,&stu[i].en,&stu[i].cs);
		  stu[i].ave=(stu[i].math+stu[i].en+stu[i].cs)/3.00;
	  	}
	  	if(stu[i].state==3)
	  	{
		  scanf("%d %d %d",&stu[i].math,&stu[i].en,&stu[i].cs);
		  
	  	}
	  	
	  }
	 for(i=0;i<=n;i++)
	   {
	   	  if(stu[i].state==1)
	   	    f1(stu,system,i);
	   	  else if(stu[i].state==2)
	   	    f2(stu,system,i);
	   	  else if(stu[i].state==3)
	   	    f3(stu,system,i);
	   	  else if(stu[i].state==4)
	   	    f4(stu,system,i);
	   }
//printf("%ld\n",system[0].id);
//printf("%ld\n",system[2].id);
//printf("storenum:%d",storenum);
return 0;	   
}
int search(STUDENT *system,long target)
{
//	printf("storenum:%d\n",storenum);
	int flag;
	int i;
	flag=0;
	for(i=0;i<=storenum;i++)
	  {	
//	  printf("system[i].id:%ld\n",system[i].id);
//	  printf("target:%ld\n",target);
	  	if(system[i].id==target)
	  	  {
	  	  	flag=1;
	  	  }	
	  }
	if (flag==1)
	  return 1;
	else 
	  return 0;
	
}
void  f1(STUDENT *stu,STUDENT *system,int target)
{
	
	if(storenum==0)
	{
		
    	system[storenum]=stu[target];
    	printf("Add success\n");
		storenum++;
	}
else
  if(search(system,stu[target].id)==1)
    {
    	printf("Students already exist\n");
    }
  else
    {	
    	system[storenum]=stu[target];
    	printf("Add success\n");
		storenum++;
    }
    //printf("%ld\n",system[0].id);
}

void  f2(STUDENT *stu,STUDENT *system,int target)
{
	int i;
	if(search(system,stu[target].id)==0)
    {
    	printf("Students do not exist\n");
    }
  else
    {
    	for(i=0;i<storenum;i++)
	    {
	  	
	     	if(system[i].id==stu[target].id)
	  	    {
	  	  	  system[i].id=0;
	  	    }
	    }
	  printf("Delete success\n");
    }
}

void  f3(STUDENT *stu,STUDENT *system,int target)
{
	int i;
	if(search(system,stu[target].id)==0)
    {
    	printf("Students do not exist\n");
    }
    else
    {
    	for(i=0;i<storenum;i++)
	    {
	  	
	     	if(system[i].id==stu[target].id)
	  	    {
	  	  	  system[i].math=stu[target].math;
	  	  	  system[i].en=stu[target].en;
	  	  	  system[i].cs=stu[target].cs;
	  	  	  system[i].ave=(system[i].math+system[i].en+system[i].cs)/3.00;
	  	  	  break;
	  	    }
	    }
	  printf("Update success\n");
    }
}

void  f4(STUDENT *stu,STUDENT *system,int target)
{
	int i;
	if(search(system,stu[target].id)==0)
    {
    	printf("Students do not exist\n");
    }
    else
    {
	  for(i=0;i<storenum;i++)
	    {
	    	if(system[i].id==stu[target].id)
	    	  {
	    	  	printf("Student ID:%ld\n",system[i].id);
	    	  	printf("Name:%s\n",system[i].name);
	    	  	printf("Average Score:%.1lf\n",system[i].ave);
	    	  }
	    }
	}
}
*/